<?php
$this->breadcrumbs = array(
	'Quản lý Nhân vật sự kiện' => array('/Events/artists/index'),
	$model->nickname
);
?>
<!-- BEGIN PORTLET-->
<div class="row">
	<div class="col-md-12 news-page blog-page">
    	<div class="blog-tag-data">
            <h3><?php echo $model->nickname; ?> <?php echo CHtml::link('<i class="icon-pencil"></i> Cập nhật thông tin', array('/Events/artists/update', 'slug'=>$model->url), array('class'=>'btn blue btn-sm')); ?></h3>
            <div class="row">
                <div class="col-md-8">
                    <div class="text-center">
                        <img src="<?php echo IMAGES_URL . 'artists/' . date('Ymd', strtotime($model->createddate)) . '/' . $model->imagecover; ?>" width="100%" alt="<?php echo $model->nickname; ?>">
                    </div>
                    <table class="table">
                        <tbody>
                            <tr>
                                <td>Tên thật</td>
                                <td><?php echo $model->fullname; ?></td>
                            </tr>
                            <tr>
                                <td>Ngày sinh</td>
                                <td><?php echo date('Y', strtotime($model->dateofbirth)); ?></td>
                            </tr>
                        </tbody>
                    </table>
                    
                    <p><strong><?php echo $model->brief; ?></strong></p>
                    <div class="news-item-page">
                        <?php echo $model->profile->description; ?>
                    </div>
                </div>
                
                <div class="col-md-4">
                    <img src="<?php echo IMAGES_URL . 'artists/' . date('Ymd', strtotime($model->createddate)) . '/' . $model->image; ?>" width="100%" alt="<?php echo $model->nickname; ?>">
                </div>
            </div>
        </div>
    </div>
</div>

<!-- BEGIN PORTLET-->
<div class="row">
	<div class="col-md-12">
        <div class="portlet">
        	<div class="portlet-title">
            	<div class="caption"><i class="icon-add"></i> Thêm sự kiện vào Slide</div>
            </div>
            <div class="portlet-body">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'sliders-form',
	'action'=>array('/Events/artists/addEvent', 'slug'=>$model->url),
	'enableClientValidation'=>false,
	'clientOptions'=>array(
		'validateOnSubmit'=>true,
	),
	'htmlOptions'=>array(
		'class'=>'horizontal-form',
	),
)); ?>
<div class="form-body">
	<div class="row">
    	<div class="col-md-9">
            <div class="form-group">
                <?php $this->widget('zii.widgets.jui.CJuiAutoComplete', array(
					'model'=>$model,
					'attribute'=>'nickname',
					'source'=>$this->createUrl('/Events/request/suggestEvent'),
					'options'=>array(
						'minLength' => '2',
						'showAnim' => 'fold',
						'select' => "js: function(event, data) {
							$('#EventArtists_event_id').val(data.item.id);
						}"
					),
					'htmlOptions'=>array(
						'class'=>'form-control'
					),
				)); ?>
                <?php echo $form->hiddenField($eventArtist, 'event_id'); ?>
                <?php echo $form->hiddenField($eventArtist, 'artist_id', array('value'=>$model->id)); ?>
            </div>
		</div>
        <div class="col-md-3">
            <button type="submit" class="btn blue" onClick="Custom.showLoading();"><i class="icon-ok"></i> Thêm vào Slider</button>
            <button type="reset" class="btn default">Cancel</button>
        </div>
	</div>
</div>
<?php $this->endWidget(); ?>
            </div>
        </div>
        
    	<div class="portlet">
        	<div class="portlet-title">
            	<div class="caption"><i class="icon-bar-chart"></i>Danh sách sự kiện</div>
            </div>
            <div class="portlet-body">
<?php $this->widget('zii.widgets.grid.CGridView', array(
	'id'=>'news-grid',
	'dataProvider'=>$dataProvider,
	'ajaxUpdate'=>true,
	'itemsCssClass'=>'table table-striped table-bordered table-advance table-hover',
	'pager'=>array(
        'header'=>'',
		'maxButtonCount'=>10,
        'header'=>'',
        'prevPageLabel'=>'<i class="icon-angle-left"></i></a>',
        'nextPageLabel'=>'<i class="icon-angle-right"></i></a>',
        'firstPageLabel'=>'First',
        'lastPageLabel'=>'Last',
        'footer'=>'',
		'selectedPageCssClass'=>'active',
		'hiddenPageCssClass'=>'disabled',
        'htmlOptions'=>array(
            'class'=>'pagination pagination-sm',
        ),
    ),
	'columns'=>array(
		array(
			'name'=>'id',
			'value'=>'$data->id',
		),
		'title',
		array(
			'class'=>'CButtonColumn',
			'header'=>'Action',
			'template'=>'{view} {delete}',
			'buttons'=>array
			(
				'view'=>array(
					'label'=>'<i class="icon-share"></i>',
					'imageUrl'=>false,
					'options'=>array(
						'class'=>'btn default btn-xs blue',
						'title'=>'View'
					),
				),
				'delete'=>array(
					'label'=>'<i class="icon-trash"></i>',
                    'url'=>'array("/Events/artists/removeEvent", "artist"=>' . $model->id . ', "event"=>$data->id)',
					'imageUrl'=>false,
					'options'=>array(
						'class'=>'btn default btn-xs black',
						'title'=>'Delete'
					),
				),
			),
			'htmlOptions'=>array(
				'width'=>'120px',
				'class'=>'text-center'
			),
		),
	),
	'htmlOptions'=>array(
		'class'=>''
	),
)); ?>
            </div>
        </div>
    </div>
</div>